package com.example.vote.controller;

import com.example.vote.mapper.MatchMapper;
import com.example.vote.model.Match;
import com.example.vote.service.MatchService;
import com.example.vote.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * ClassName: MatchController
 * Package: com.example.vote.controller
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-06-26
 * Time: 10:29
 */

@RestController
@RequestMapping("/match")
public class MatchController {

    //比赛信息
    @Autowired
    private MatchService matchService;

    @Autowired
    private MatchMapper matchMapper;

    @GetMapping("/find")
    public Result<List<Match>> find(){

        //之前数据查询报错 因为match表名 是sql中的关键字 该了一个别名之后就好了
        List<Match> list = matchMapper.selectList(null);
        return new Result<>(1,"查询成功",list);

    }

}
